package com.hua.designpattern.creational.prototype;

public class CloneDeep implements Cloneable {
	private int id = 1;
	private Integer age = new Integer(2);
	private String name = new String("3");
	private PersonDeep person = new PersonDeep();

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public PersonDeep getPerson() {
		return person;
	}

	public void setPerson(PersonDeep person) {
		this.person = person;
	}

	@Override
	public String toString() {
		return super.toString() + " [id=" + id + " ;age=" + age + "; name=" + name + " ;person=" + person + "]";
	}

	public CloneDeep clone() {
		try {
			CloneDeep object = (CloneDeep) super.clone();
			object.person = person.clone();
			return object;
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return null;

	}
}
